#pragma once
#include <string>
#include <cstdlib>
#include <string>
using namespace std;

class HighScoreData
{
public:
	HighScoreData();
	HighScoreData(int score, string name);
	~HighScoreData();

	void setScore(int score) { this->score = score; }
	int getScore() { return score; }
	void setName(string name) { this->name = name; }
	string getName() { return name; }

	bool operator < (const HighScoreData &str) const
	{
		if (score < str.score)
			return true;
		else if (score > str.score)
		{
			return false;
		}
		else
		{
			return name.compare(str.name) > 0;
		}
	}
	bool operator > (const HighScoreData &str) const
	{
		if (score > str.score)
			return true;
		else if (score < str.score)
		{
			return false;
		}
		else
		{
			return name.compare(str.name) < 0;
		}
	}

	friend ostream & operator << (ostream &stream, HighScoreData &hsd){
		stream << hsd.score << ',' << hsd.name << endl;
		return stream;
	}

	friend istream & operator >> (istream &stream, HighScoreData &hsd){
		int i;
		char c;
		string s;
		stream >> i >> c;
		getline(stream, s);
		hsd.setScore(i);
		hsd.setName(s);
		return stream;
	}


private:
	int score;
	string name;

};

